<script language="javascript"><!--

function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=700,height=480,screenX=150,screenY=150,top=150,left=150')
}
//--></script>
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
  <tr>
    
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">		 
          <tr>
            <td class="componentheading" valign="top"><?php echo HEADING_TITLE; ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>


	  <tr>
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">          
		  <tr>
			<td class="smallText" align="left"></td>
		  
			<td class="main" align="right"><?php echo '<a href="javascript:popupWindow(\'' . tep_href_link(FILENAME_POPUP_CONTEST) . '\')">' . TEXT_CONTEST_HELP_LINK . '</a>'; ?>&nbsp;</td>
		  </tr>
		</table></td>
	  </tr>
	  
	  <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>

      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php
  $contest_query_raw = "select g.entry_id, gd.entry_text as contest_text, g.entry_rating, g.date_added, g.contestants_name, g.contestants_location from " . TABLE_CONTEST . " g, " . TABLE_ENTER_CONTEST_DESCRIPTION . " gd where g.entry_id = gd.entry_id and gd.languages_id = '" . (int)$languages_id . "' and g.entry_status = '1' order by g.entry_id desc";
  $contest_split = new splitPageResults($contest_query_raw, CONTEST_MAX_DISPLAY_ENTRIES);

  if ($contest_split->number_of_rows > 0) {
    if ((CONTEST_PREV_NEXT_BAR_LOCATION == '1') || (CONTEST_PREV_NEXT_BAR_LOCATION == '3')) {

?>
               <tr>
                <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
                  <tr>
                    <td class="smallText" align="left" width="80%"><?php echo $contest_split->display_count(TEXT_DISPLAY_NUMBER_OF_CONTESTANT_ENTRIES); ?></td>
               <td><?php echo TEXT_RESULT_PAGE . ' ' . $contest_split->display_links(CONTEST_MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info'))); ?></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
              <tr>
                <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
              </tr> </tr>

<?php
    }
    $contest_query = tep_db_query($contest_split->sql_query);
    while ($contest = tep_db_fetch_array($contest_query)) {
?>
              <tr>
                <td><table border="0" width="100%" cellspacing="0" cellpadding="2" class="infoBox">
                  <tr class="infoBoxContents">
                    <td class="main"><?php echo '<b>' . sprintf(tep_output_string_protected($contest['contestants_name'])) . '</b>' . '&nbsp;&nbsp;<i>' . tep_output_string_protected($contest['contestants_location']) . '</i>'; ?></td>
                    <td class="smallText" align="right"><?php echo sprintf(TEXT_CONTEST_DATE_ENTERED, tep_date_short($contest['date_added'])); ?></td>
                  </tr>
				  <tr>
				    <td class="smallText" align="left"><?php echo nl2br(tep_break_string(tep_output_string_protected($contest['contest_text']), 60, '-<br>')); ?></td>
				  </tr>				  
                </table></td>
              </tr>
			

              <!--<tr>
                <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
                  <tr class="infoBoxContents">
                    <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
                      <tr>
                        <td valign="top" class="main"><div align="justify"><?php echo nl2br(tep_break_string(tep_output_string_protected($contest['contest_text']), 60, '-<br>')); ?></div></td>
                      </tr>
                    </table></td>
                  </tr>
                </table></td>
              </tr>-->
           <tr>
             <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
           </tr>
<?php
    }
?>
<?php
  } else {
?>
            <tr>
              <td><?php new infoBox(array(array('text' => TEXT_NO_CONTESTANT_ENTRIES))); ?></td>
            </tr>
            <tr>
              <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
            </tr>
		  </table></td>
        </tr>
<?php
  }

  if (($contest_split->number_of_rows > 0) && ((CONTEST_PREV_NEXT_BAR_LOCATION == '2') || (CONTEST_PREV_NEXT_BAR_LOCATION == '3'))) {
?>
         <tr>
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td class="smallText" align="left" width="80%"><?php echo $contest_split->display_count(TEXT_DISPLAY_NUMBER_OF_CONTESTANT_ENTRIES); ?></td>
               <td><?php echo TEXT_RESULT_PAGE . ' ' . $contest_split->display_links(CONTEST_MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info'))); ?></td>
             </tr>
           </table></td>
         </tr>
      
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
	   
<?php
   }
?>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
	     <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
         <tr>
           <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
             <tr class="infoBoxContents">
               <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
                 <tr>
                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                   <td align="left"><a href="javascript:history.back(-1);"><?php echo tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>
				   <td class="main" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ENTER_CONTEST, tep_get_all_get_params()) . '">' . tep_image_button('button_enter_contest.gif', IMAGE_BUTTON_ENTER_CONTEST) . '</a>'; ?>&nbsp;&nbsp;</td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
	  </tr>
    </table></td>
     
<!-- body_text_eof //-->
    
  </tr>
</table>